<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>调试宏 DPRINTF DERROR PERR | 机器人的博客</title>
  <meta name="keywords" content=" 调试宏 , DPRINTF , DERROR , PERR ">
  <meta name="description" content="调试宏 DPRINTF DERROR PERR | 机器人的博客">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="description" content="页面未找到！">
<meta property="og:type" content="website">
<meta property="og:title" content="404">
<meta property="og:url" content="http://ancjf.com/404.html">
<meta property="og:site_name" content="机器人的博客">
<meta property="og:description" content="页面未找到！">
<meta property="og:locale" content="en_US">
<meta property="article:published_time" content="2020-04-18T07:23:22.000Z">
<meta property="article:modified_time" content="2020-04-18T07:23:50.777Z">
<meta property="article:author" content="ancjf">
<meta name="twitter:card" content="summary">


<link rel="icon" href="/img/avatar.jpg">

<link href="/css/style.css?v=1.0.1" rel="stylesheet">

<link href="/css/hl_theme/atom-light.css?v=1.0.1" rel="stylesheet">

<link href="//cdn.bootcss.com/animate.css/3.5.2/animate.min.css" rel="stylesheet">
<link href="//cdn.bootcss.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">

<script src="//cdn.bootcss.com/jquery/2.2.4/jquery.min.js"></script>
<script src="/js/jquery.autocomplete.min.js?v=1.0.1" ></script>

<script src="//cdn.bootcss.com/highlight.js/9.12.0/highlight.min.js"></script>
<script>
    hljs.initHighlightingOnLoad();
</script>

<script src="//cdn.bootcss.com/nprogress/0.2.0/nprogress.min.js"></script>



<script src="//cdn.bootcss.com/jquery-cookie/1.4.1/jquery.cookie.min.js" ></script>

<script src="/js/iconfont.js?v=1.0.1" ></script>

<meta name="generator" content="Hexo 4.2.0"></head>
<div style="display: none">
  <input class="theme_disqus_on" value="false">
  <input class="theme_preload_comment" value="false">
  <input class="theme_blog_path" value="">
</div>

<body>
<aside class="nav">
    <div class="nav-left">
        <a href="/" class="avatar_target">
    <img class="avatar" src="/img/avatar.jpg" />
</a>
<div class="author">
    <span>ancjf</span>
</div>

<div class="icon">
    
        
        <a title="github" href="https://github.com/ancjf" target="_blank">
            
                <svg class="iconfont-svg" aria-hidden="true">
                    <use xlink:href="#icon-github"></use>
                </svg>
            
        </a>
        
    
        
        <a title="zhihu" href="https://www.zhihu.com/people/ancjf" target="_blank">
            
                <svg class="iconfont-svg" aria-hidden="true">
                    <use xlink:href="#icon-zhihu"></use>
                </svg>
            
        </a>
        
    
        
        <a title="csdn" href="http://blog.csdn.net/ancjf" target="_blank">
            
                <svg class="iconfont-svg" aria-hidden="true">
                    <use xlink:href="#icon-csdn"></use>
                </svg>
            
        </a>
        
    
        
        <a title="email" href="mailto:ancjf@163.com" target="_blank">
            
                <svg class="iconfont-svg" aria-hidden="true">
                    <use xlink:href="#icon-email"></use>
                </svg>
            
        </a>
        
    
        
        <a title="qq" href="http://wpa.qq.com/msgrd?v=3&uin=156715133&site=qq&menu=yes" target="_blank">
            
                <svg class="iconfont-svg" aria-hidden="true">
                    <use xlink:href="#icon-qq"></use>
                </svg>
            
        </a>
        
    
</div>




<ul>
    <li><div class="all active">全部文章<small>(26)</small></div></li>
    
        
            
            <li><div data-rel="linux">linux<small>(12)</small></div>
                
            </li>
            
        
    
        
            
            <li><div data-rel="区块链">区块链<small>(8)</small></div>
                
            </li>
            
        
    
        
            
            <li><div data-rel="c++">c++<small>(4)</small></div>
                
            </li>
            
        
    
        
            
            <li><div data-rel="react native">react native<small>(2)</small></div>
                
            </li>
            
        
    
</ul>
<div class="left-bottom">
    <div class="menus">
    
    
    
    
    </div>
    <div><a class="about  hasFriend  site_url"  href="/about">关于</a><a style="width: 50%"  class="friends">友链</a></div>
</div>
<input type="hidden" id="yelog_site_posts_number" value="26">

<div style="display: none">
    <span id="busuanzi_value_site_uv"></span>
    <span id="busuanzi_value_site_pv"></span>
</div>

    </div>
    <div class="nav-right">
        <div class="friends-area">
    <div class="friends-title">
        友情链接
        <i class="back-title-list"></i>
    </div>
    <div class="friends-content">
        <ul>
            
            <li><a target="_blank" href="http://yelog.org/">叶落阁</a></li>
            
        </ul>
    </div>
</div>
        <div class="title-list">
    <form onkeydown="if(event.keyCode === 13){return false;}">
        <input id="local-search-input" class="search" type="text" placeholder="Search..." />
        <i class="cross"></i>
        <span>
            <label for="tagswitch">Tags:</label>
            <input id="tagswitch" type="checkbox" style="display: none" />
            <i id="tagsWitchIcon"></i>
        </span>
    </form>
    <div class="tags-list">
    
    <li class="article-tag-list-item">
        <a class="color1">linux</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color5">内存管理</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color5">伙伴系统</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color5">内存分配</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color5">内存释放</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color3">伙伴系统初始化</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color5">Slab</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color4">EOS</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color3">节点</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color5">数据备份</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color4">c语言</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color1">二分法查找</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color5">geth</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color2">私有网络搭建</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color4">以太坊</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color4">c++</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color4">rpc</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color5">code-push</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color3">react native</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color3">样式</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color4">调试宏</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color3">DPRINTF</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color2">DERROR</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color5">PERR</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color5">gbk2312，拼音表，排好</a>
    </li>
    
    <div class="clearfix"></div>
</div>

    
    <nav id="title-list-nav">
        
        <a id="top" class="区块链 "
           href="/2018/09/29/EOS-%E8%8A%82%E7%82%B9%E6%95%B0%E6%8D%AE%E5%A4%87%E4%BB%BD/"
           data-tag="EOS,节点,数据备份"
           data-author="" >
            <span class="post-title" title="EOS 节点数据备份">EOS 节点数据备份</span>
            <span class="post-date" title="2018-09-29 21:51:16">2018/09/29</span>
        </a>
        
        <a id="top" class="区块链 "
           href="/2018/07/29/%E4%BB%A5%E5%A4%AA%E5%9D%8A/"
           data-tag="以太坊"
           data-author="" >
            <span class="post-title" title="以太坊">以太坊</span>
            <span class="post-date" title="2018-07-29 20:50:06">2018/07/29</span>
        </a>
        
        <a id="top" class="linux "
           href="/2013/05/18/linux-3-4-10-%E5%86%85%E6%A0%B8%E5%86%85%E5%AD%98%E7%AE%A1%E7%90%86%E6%BA%90%E4%BB%A3%E7%A0%81%E5%88%86%E6%9E%901%EF%BC%9A%E6%BA%90%E4%BB%A3%E7%A0%81%E9%98%85%E8%AF%BB%E5%B7%A5%E5%85%B7%EF%BC%8C%E7%BC%96%E8%AF%91%E5%8F%8A%E8%B0%83%E8%AF%95/"
           data-tag="linux,内存管理"
           data-author="" >
            <span class="post-title" title="linux 源代码分析1:源代码阅读工具，编译及调试">linux 源代码分析1:源代码阅读工具，编译及调试</span>
            <span class="post-date" title="2013-05-18 10:18:17">2013/05/18</span>
        </a>
        
        <a id="top" class="linux "
           href="/2013/05/19/linux-3-4-10-%E5%86%85%E6%A0%B8%E5%86%85%E5%AD%98%E7%AE%A1%E7%90%86%E6%BA%90%E4%BB%A3%E7%A0%81%E5%88%86%E6%9E%902%EF%BC%9A%E4%BC%99%E4%BC%B4%E7%B3%BB%E7%BB%9F/"
           data-tag="linux,内存管理,伙伴系统"
           data-author="" >
            <span class="post-title" title="linux 源代码分析2:伙伴系统">linux 源代码分析2:伙伴系统</span>
            <span class="post-date" title="2013-05-19 11:08:56">2013/05/19</span>
        </a>
        
        <a id="top" class="linux "
           href="/2013/05/20/linux-3-4-10-%E5%86%85%E6%A0%B8%E5%86%85%E5%AD%98%E7%AE%A1%E7%90%86%E6%BA%90%E4%BB%A3%E7%A0%81%E5%88%86%E6%9E%903-%E4%BC%99%E4%BC%B4%E7%B3%BB%E7%BB%9F%E5%86%85%E5%AD%98%E5%88%86%E9%85%8D/"
           data-tag="linux,内存管理,伙伴系统,内存分配"
           data-author="" >
            <span class="post-title" title="linux 源代码分析3:伙伴系统内存分配">linux 源代码分析3:伙伴系统内存分配</span>
            <span class="post-date" title="2013-05-20 19:29:04">2013/05/20</span>
        </a>
        
        <a id="top" class="linux "
           href="/2013/05/21/linux-3-4-10-%E5%86%85%E6%A0%B8%E5%86%85%E5%AD%98%E7%AE%A1%E7%90%86%E6%BA%90%E4%BB%A3%E7%A0%81%E5%88%86%E6%9E%904-%E4%BC%99%E4%BC%B4%E7%B3%BB%E7%BB%9F%E5%86%85%E5%AD%98%E9%87%8A%E6%94%BE/"
           data-tag="linux,内存管理,伙伴系统,内存释放"
           data-author="" >
            <span class="post-title" title="linux 源代码分析4:伙伴系统内存释放">linux 源代码分析4:伙伴系统内存释放</span>
            <span class="post-date" title="2013-05-21 20:25:33">2013/05/21</span>
        </a>
        
        <a id="top" class="linux "
           href="/2013/05/22/linux-3-4-10-%E5%86%85%E6%A0%B8%E5%86%85%E5%AD%98%E7%AE%A1%E7%90%86%E6%BA%90%E4%BB%A3%E7%A0%81%E5%88%86%E6%9E%905-%E4%BC%99%E4%BC%B4%E7%B3%BB%E7%BB%9F%E5%88%9D%E5%A7%8B%E5%8C%96/"
           data-tag="linux,内存管理,伙伴系统,伙伴系统初始化"
           data-author="" >
            <span class="post-title" title="linux 源代码分析5:伙伴系统初始化">linux 源代码分析5:伙伴系统初始化</span>
            <span class="post-date" title="2013-05-22 21:59:15">2013/05/22</span>
        </a>
        
        <a id="top" class="linux "
           href="/2013/06/03/linux-3-4-10-%E5%86%85%E6%A0%B8%E5%86%85%E5%AD%98%E7%AE%A1%E7%90%86%E6%BA%90%E4%BB%A3%E7%A0%81%E5%88%86%E6%9E%906-Slab%E5%88%86%E9%85%8D%E5%99%A8/"
           data-tag="linux,内存管理,伙伴系统,Slab"
           data-author="" >
            <span class="post-title" title="linux 源代码分析6:Slab分配器">linux 源代码分析6:Slab分配器</span>
            <span class="post-date" title="2013-06-03 19:28:59">2013/06/03</span>
        </a>
        
        <a id="top" class="linux "
           href="/2013/06/05/linux-3-4-10-%E5%86%85%E6%A0%B8%E5%86%85%E5%AD%98%E7%AE%A1%E7%90%86%E6%BA%90%E4%BB%A3%E7%A0%81%E5%88%86%E6%9E%907-Slab%E5%9D%97%E7%9A%84%E7%AE%A1%E7%90%86/"
           data-tag="linux,内存管理,伙伴系统,Slab"
           data-author="" >
            <span class="post-title" title="linux 源代码分析7:Slab块的管理">linux 源代码分析7:Slab块的管理</span>
            <span class="post-date" title="2013-06-05 20:56:05">2013/06/05</span>
        </a>
        
        <a id="top" class="linux "
           href="/2013/06/04/linux-3-4-10-%E5%86%85%E6%A0%B8%E5%86%85%E5%AD%98%E7%AE%A1%E7%90%86%E6%BA%90%E4%BB%A3%E7%A0%81%E5%88%86%E6%9E%908-Slab%E5%86%85%E5%AD%98%E5%88%86%E9%85%8D/"
           data-tag="linux,内存管理,伙伴系统,Slab"
           data-author="" >
            <span class="post-title" title="linux 源代码分析8:Slab内存分配">linux 源代码分析8:Slab内存分配</span>
            <span class="post-date" title="2013-06-04 19:47:29">2013/06/04</span>
        </a>
        
        <a id="top" class="linux "
           href="/2013/06/09/linux-3-4-10-%E5%86%85%E6%A0%B8%E5%86%85%E5%AD%98%E7%AE%A1%E7%90%86%E6%BA%90%E4%BB%A3%E7%A0%81%E5%88%86%E6%9E%909-Slab%E5%86%85%E5%AD%98%E9%87%8A%E6%94%BE/"
           data-tag="linux,内存管理,伙伴系统,Slab"
           data-author="" >
            <span class="post-title" title="linux 源代码分析9:Slab内存释放">linux 源代码分析9:Slab内存释放</span>
            <span class="post-date" title="2013-06-09 20:17:42">2013/06/09</span>
        </a>
        
        <a id="top" class="linux "
           href="/2013/06/09/linux-3-4-10-%E5%86%85%E6%A0%B8%E5%86%85%E5%AD%98%E7%AE%A1%E7%90%86%E6%BA%90%E4%BB%A3%E7%A0%81%E5%88%86%E6%9E%9010-slab%E9%80%9A%E7%94%A8%E9%95%BF%E5%BA%A6%E5%86%85%E5%AD%98%E5%88%86%E9%85%8D/"
           data-tag="linux,内存管理,伙伴系统,Slab"
           data-author="" >
            <span class="post-title" title="linux 源代码分析10:slab通用长度内存分配">linux 源代码分析10:slab通用长度内存分配</span>
            <span class="post-date" title="2013-06-09 20:17:42">2013/06/09</span>
        </a>
        
        <a id="top" class="linux "
           href="/2013/06/12/linux-3-4-10-%E5%86%85%E6%A0%B8%E5%86%85%E5%AD%98%E7%AE%A1%E7%90%86%E6%BA%90%E4%BB%A3%E7%A0%81%E5%88%86%E6%9E%9011-Slab%E5%88%9D%E5%A7%8B%E5%8C%96/"
           data-tag="linux,内存管理,伙伴系统,Slab"
           data-author="" >
            <span class="post-title" title="linux 源代码分析11:Slab初始化">linux 源代码分析11:Slab初始化</span>
            <span class="post-date" title="2013-06-12 19:43:06">2013/06/12</span>
        </a>
        
        <a id="top" class="区块链 "
           href="/2020/03/29/ok6410-u-boot-dm9000-%E9%A9%B1%E5%8A%A8%E8%A1%A5%E4%B8%81-patch/"
           data-tag=""
           data-author="" >
            <span class="post-title" title="ok6410 u-boot dm9000 驱动补丁 patch">ok6410 u-boot dm9000 驱动补丁 patch</span>
            <span class="post-date" title="2020-03-29 21:58:09">2020/03/29</span>
        </a>
        
        <a id="top" class="区块链 "
           href="/2020/03/29/eostoolkit-%E5%AE%89%E8%A3%85/"
           data-tag=""
           data-author="" >
            <span class="post-title" title="eostoolkit 安装">eostoolkit 安装</span>
            <span class="post-date" title="2020-03-29 21:58:09">2020/03/29</span>
        </a>
        
        <a id="top" class="linux "
           href="/2020/03/29/sdl2-%E5%92%8C-dmalloc-%E4%B8%8D%E5%85%BC%E5%AE%B9/"
           data-tag=""
           data-author="" >
            <span class="post-title" title="sdl2 和 dmalloc 不兼容">sdl2 和 dmalloc 不兼容</span>
            <span class="post-date" title="2020-03-29 21:58:09">2020/03/29</span>
        </a>
        
        <a id="top" class="区块链 "
           href="/2018/07/29/bitcoin-%E6%B5%8B%E8%AF%95%E7%BD%91%E7%BB%9C/"
           data-tag=""
           data-author="" >
            <span class="post-title" title="bitcoin 测试网络">bitcoin 测试网络</span>
            <span class="post-date" title="2018-07-29 20:50:06">2018/07/29</span>
        </a>
        
        <a id="top" class="区块链 "
           href="/2018/07/29/USDT%E9%92%B1%E5%8C%85%E5%BD%92%E9%9B%86/"
           data-tag=""
           data-author="" >
            <span class="post-title" title="USDT钱包归集">USDT钱包归集</span>
            <span class="post-date" title="2018-07-29 20:50:06">2018/07/29</span>
        </a>
        
        <a id="top" class="c++ "
           href="/2012/10/24/%E8%B0%83%E8%AF%95%E5%AE%8F-DPRINTF-DERROR-PERR/"
           data-tag="调试宏,DPRINTF,DERROR,PERR"
           data-author="" >
            <span class="post-title" title="调试宏 DPRINTF DERROR PERR">调试宏 DPRINTF DERROR PERR</span>
            <span class="post-date" title="2012-10-24 17:38:38">2012/10/24</span>
        </a>
        
        <a id="top" class="区块链 "
           href="/2018/08/29/%E6%AF%94%E7%89%B9%E5%B8%81%E5%AE%A2%E6%88%B7%E7%AB%AFbitcoind%E7%9A%84%E9%AB%98%E7%BA%A7%E7%94%A8%E6%B3%95/"
           data-tag=""
           data-author="" >
            <span class="post-title" title="比特币客户端bitcoind的高级用法">比特币客户端bitcoind的高级用法</span>
            <span class="post-date" title="2018-08-29 20:51:09">2018/08/29</span>
        </a>
        
        <a id="top" class="区块链 "
           href="/2016/11/23/geth%E7%A7%81%E6%9C%89%E7%BD%91%E7%BB%9C%E6%90%AD%E5%BB%BA/"
           data-tag="geth,私有网络搭建"
           data-author="" >
            <span class="post-title" title="geth私有网络搭建">geth私有网络搭建</span>
            <span class="post-date" title="2016-11-23 17:51:36">2016/11/23</span>
        </a>
        
        <a  class="react native "
           href="/2020/09/15/react-native-%E6%A0%B7%E5%BC%8F/"
           data-tag="react native,样式"
           data-author="" >
            <span class="post-title" title="react native 样式">react native 样式</span>
            <span class="post-date" title="2020-09-15 08:58:46">2020/09/15</span>
        </a>
        
        <a  class="c++ "
           href="/2020/09/15/c%E8%AF%AD%E8%A8%80-%E4%BA%8C%E5%88%86%E6%B3%95%E6%9F%A5%E6%89%BE/"
           data-tag="c语言,二分法查找"
           data-author="" >
            <span class="post-title" title="c语言 二分法查找">c语言 二分法查找</span>
            <span class="post-date" title="2020-09-15 08:51:53">2020/09/15</span>
        </a>
        
        <a  class="react native "
           href="/2020/05/19/code-push%E4%BD%BF%E7%94%A8%E8%AE%B0%E5%BD%95/"
           data-tag="code-push"
           data-author="" >
            <span class="post-title" title="code-push使用记录">code-push使用记录</span>
            <span class="post-date" title="2020-05-19 16:54:53">2020/05/19</span>
        </a>
        
        <a  class="c++ "
           href="/2018/09/15/%E4%BB%A5%E5%A4%AA%E5%9D%8Ac++%E7%89%88%E6%9C%ACrpc%E6%8E%A5%E5%8F%A3%E6%B7%BB%E5%8A%A0/"
           data-tag="以太坊,c++,rpc"
           data-author="" >
            <span class="post-title" title="以太坊c++版本rpc接口添加">以太坊c++版本rpc接口添加</span>
            <span class="post-date" title="2018-09-15 16:06:05">2018/09/15</span>
        </a>
        
        <a  class="c++ "
           href="/2011/04/28/gbk2312%E6%8B%BC%E9%9F%B3%E8%A1%A8-%E6%8C%89%E8%AF%8D%E9%A2%91%E6%8E%92%E5%A5%BD%E5%BA%8F%E7%9A%84/"
           data-tag="gbk2312，拼音表，排好"
           data-author="" >
            <span class="post-title" title="gbk2312拼音表 按词频排好序的">gbk2312拼音表 按词频排好序的</span>
            <span class="post-date" title="2011-04-28 11:21:00">2011/04/28</span>
        </a>
        
    </nav>
</div>
    </div>
    <div class="hide-list">
        <div class="semicircle">
            <div class="brackets first"><</div>
            <div class="brackets">&gt;</div>
        </div>
    </div>
</aside>
<div class="post">
    <div class="pjax">
        <article id="post-调试宏-DPRINTF-DERROR-PERR" class="article article-type-post" itemscope itemprop="blogPost">
    
        <h1 class="article-title">调试宏 DPRINTF DERROR PERR</h1>
    
    <div class="article-meta">
        
        <span class="top"><a>置顶</a></span>
        
        
        
        <span class="book">
            
                <a  data-rel="c++">c++</a>
            
        </span>
        
        
        <span class="tag">
            
            <a class="color4">调试宏</a>
            
            <a class="color3">DPRINTF</a>
            
            <a class="color2">DERROR</a>
            
            <a class="color5">PERR</a>
            
        </span>
        
    </div>
    <div class="article-meta">
        
        创建时间:<time class="date" title='更新时间: 2020-09-15 08:25:50'>2012-10-24 17:38</time>
        
    </div>
    <div class="article-meta">
        
        
        <span id="busuanzi_container_page_pv">
            阅读:<span id="busuanzi_value_page_pv">
                <span class="count-comment">
                    <span class="spinner">
                      <div class="cube1"></div>
                      <div class="cube2"></div>
                    </span>
                </span>
            </span>
        </span>
        
        
    </div>
    
    <div class="toc-ref">
    
        <ol class="toc"><li class="toc-item toc-level-1"><a class="toc-link" href="#头文件"><span class="toc-text">头文件</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#源文件"><span class="toc-text">源文件</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#适合c-11-的-DPRINTF宏："><span class="toc-text">适合c++11 的 DPRINTF宏：</span></a></li></ol>
    
<style>
    .left-col .switch-btn,
    .left-col .switch-area {
        display: none;
    }
    .toc-level-3 i,
    .toc-level-3 ol {
        display: none !important;
    }
</style>
</div>
    
    <div class="article-entry" itemprop="articleBody">
      
        <h1 id="头文件"><a href="#头文件" class="headerlink" title="头文件"></a>头文件</h1><pre><code>#ifndef DPRINTF_H
#define DPRINTF_H

extern const char *COLOR_ARG[];

int perr(const char *file, int line, const char *funtion, int err);

#ifdef DEBUG
#define PERR(x) perr(__FILE__, __LINE__, __FUNCTION__, (x))
#define DPRINTF(x, str,...)  do{fprintf(stdout, &quot;%s%s::%s::%d:\t&quot;str&quot;\033[39;49;0m\n&quot;, COLOR_ARG[(x)&amp;7], __FILE__, __FUNCTION__, __LINE__, ##__VA_ARGS__);}while(0)
#define DERROR(str, ...) do{fprintf(stderr, &quot;\033[31;1m%s::%s::%d:\t&quot;str&quot;\033[39;49;0m\n&quot;,  __FILE__, __FUNCTION__, __LINE__, ##__VA_ARGS__);}while(0)
#else
#define PERR(x) (x)
#define DPRINTF(str,...)      
#define DERROR(str, ...)                   
#endif

#endif</code></pre><h1 id="源文件"><a href="#源文件" class="headerlink" title="源文件"></a>源文件</h1><pre><code>#include &lt;stdio.h&gt;
#include &lt;stdlib.h&gt;
#include &lt;string.h&gt;
#include &lt;errno.h&gt;

const char *COLOR_ARG[] = {
&quot;\033[37;40m&quot;,//白色
&quot;\033[33;40m&quot;,//黄色
&quot;\033[35;40m&quot;,//紫色
&quot;\033[31;40m&quot;,//红色
&quot;\033[37;5m&quot;, //白色闪烁
&quot;\033[33;5m&quot;, //黄色闪烁
&quot;\033[35;5m&quot;, //紫色闪烁
&quot;\033[31;5m&quot;, //红色闪烁
};

int perr(const char *file, int line, const char *funtion, int err)
{
char buffer[1024];
if(err)
fprintf(stderr, &quot;\033[31;1m%s::%d::%s\t%d:\t%s\033[39;49;0m\n&quot;, file, line, funtion, err, strerror_r(errno, buffer, sizeof(buffer)));
return err;
}</code></pre><h1 id="适合c-11-的-DPRINTF宏："><a href="#适合c-11-的-DPRINTF宏：" class="headerlink" title="适合c++11 的 DPRINTF宏："></a>适合c++11 的 DPRINTF宏：</h1><pre><code>#define DPRINTF(str, ...)    do{std::string __tmp = std::string(&quot;%s::%s::%d:\t&quot;) + std::string(str) + std::string(&quot;\n&quot;);  printf(__tmp.c_str(), /*&quot;%s::%s::%d:\t&quot;##str##&quot;\n&quot;, */__FILE__, __FUNCTION__, __LINE__, ##__VA_ARGS__);}while(0)</code></pre>
      
       <hr><span style="font-style: italic;color: gray;"> 转载请注明来源，欢迎对文章中的引用来源进行考证，欢迎指出任何有错误或不够清晰的表达。可以在下面评论区评论，也可以邮件至 ancjf@163.com </span>
    </div>
</article>


<p>
    <a  class="dashang" onclick="dashangToggle()">赏</a>
</p>


<div class="article_copyright">
    <p><span class="copy-title">文章标题:</span>调试宏 DPRINTF DERROR PERR</p>
    
    <p><span class="copy-title">本文作者:</span><a  title="ancjf">ancjf</a></p>
    <p><span class="copy-title">发布时间:</span>2012-10-24, 17:38:38</p>
    <p><span class="copy-title">最后更新:</span>2020-09-15, 08:25:50</p>
    <span class="copy-title">原始链接:</span><a class="post-url" href="/2012/10/24/%E8%B0%83%E8%AF%95%E5%AE%8F-DPRINTF-DERROR-PERR/" title="调试宏 DPRINTF DERROR PERR">http://ancjf.com/2012/10/24/%E8%B0%83%E8%AF%95%E5%AE%8F-DPRINTF-DERROR-PERR/</a>
    <p>
        <span class="copy-title">版权声明:</span><i class="fa fa-creative-commons"></i> <a rel="license noopener" href="http://creativecommons.org/licenses/by-nc-sa/4.0/" target="_blank" title="CC BY-NC-SA 4.0 International" target = "_blank">"署名-非商用-相同方式共享 4.0"</a> 转载请保留原文链接及作者。
    </p>
</div>





    




    </div>
    <div class="copyright">
        <p class="footer-entry">©2016-2019 Yelog</p>
<p class="footer-entry">Built with <a href="https://hexo.io/" target="_blank">Hexo</a> and <a href="https://github.com/yelog/hexo-theme-3-hexo" target="_blank">3-hexo</a> theme</p>

    </div>
    <div class="full-toc">
        <button class="full"><span class="min "></span></button>
<button class="post-toc-menu"><span class="post-toc-menu-icons"></span></button>
<div class="post-toc"><span class="post-toc-title">目录</span>
    <div class="post-toc-content">

    </div>
</div>
<a class="" id="rocket" ></a>

    </div>
</div>
<div class="acParent"></div>

<div class="hide_box" onclick="dashangToggle()"></div>
<div class="shang_box">
    <a class="shang_close"  onclick="dashangToggle()">×</a>
    <div class="shang_tit">
        <p>喜欢就点赞,疼爱就打赏</p>
    </div>
    <div class="shang_payimg">
        <div class="pay_img">
            <img src="/img/alipay.jpg" class="alipay" title="扫码支持">
            <img src="/img/weixin.jpg" class="weixin" title="扫码支持">
        </div>
    </div>
    <div class="shang_payselect">
        <span><label><input type="radio" name="pay" checked value="alipay">支付宝</label></span><span><label><input type="radio" name="pay" value="weixin">微信</label></span>
    </div>
</div>


</body>
<script src="/js/jquery.pjax.js?v=1.0.1" ></script>

<script src="/js/script.js?v=1.0.1" ></script>
<script>
    var img_resize = 'default';
    /*作者、标签的自动补全*/
    $(function () {
        $('.search').AutoComplete({
            'data': ['#linux','#内存管理','#伙伴系统','#内存分配','#内存释放','#伙伴系统初始化','#Slab','#EOS','#节点','#数据备份','#c语言','#二分法查找','#geth','#私有网络搭建','#以太坊','#c++','#rpc','#code-push','#react native','#样式','#调试宏','#DPRINTF','#DERROR','#PERR','#gbk2312，拼音表，排好',],
            'itemHeight': 20,
            'width': 418
        }).AutoComplete('show');
    })
    function initArticle() {
        /*渲染对应的表格样式*/
        
            $(".post .pjax table").addClass("green_title");
        

        /*渲染打赏样式*/
        
        $("input[name=pay]").on("click", function () {
            if($("input[name=pay]:checked").val()=="weixin"){
                $(".shang_box .shang_payimg .pay_img").addClass("weixin_img");
            } else {
                $(".shang_box .shang_payimg .pay_img").removeClass("weixin_img");
            }
        })
        

        /*高亮代码块行号*/
        
        $('pre code').each(function(){
            var lines = $(this).text().split('\n').length - 1, widther='';
            if (lines>99) {
                widther = 'widther'
            }
            var $numbering = $('<ul/>').addClass('pre-numbering ' + widther).attr("unselectable","on");
            $(this).addClass('has-numbering ' + widther)
                    .parent()
                    .append($numbering);
            for(var i=1;i<=lines;i++){
                $numbering.append($('<li/>').text(i));
            }
        });
        

        /*访问数量*/
        
        $.getScript("//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js");
        

        /*代码高亮，行号对齐*/
        $('.pre-numbering').css('line-height',$('.has-numbering').css('line-height'));

        
        
    }

    /*打赏页面隐藏与展示*/
    
    function dashangToggle() {
        $(".shang_box").fadeToggle();
        $(".hide_box").fadeToggle();
    }
    

</script>

<!--加入行号的高亮代码块样式-->

<style>
    pre{
        position: relative;
        margin-bottom: 24px;
        border-radius: 10px;
        border: 1px solid #e2dede;
        background: #FFF;
        overflow: hidden;
    }
    code.has-numbering{
        margin-left: 30px;
    }
    code.has-numbering.widther{
        margin-left: 35px;
    }
    .pre-numbering{
        margin: 0px;
        position: absolute;
        top: 0;
        left: 0;
        width: 20px;
        padding: 0.5em 3px 0.7em 5px;
        border-right: 1px solid #C3CCD0;
        text-align: right;
        color: #AAA;
        background-color: #fafafa;
    }
    .pre-numbering.widther {
        width: 35px;
    }
</style>

<!--自定义样式设置-->
<style>
    
    
    .nav {
        width: 542px;
    }
    .nav.fullscreen {
        margin-left: -542px;
    }
    .nav-left {
        width: 120px;
    }
    
    
    @media screen and (max-width: 1468px) {
        .nav {
            width: 492px;
        }
        .nav.fullscreen {
            margin-left: -492px;
        }
        .nav-left {
            width: 100px;
        }
    }
    
    
    @media screen and (max-width: 1024px) {
        .nav {
            width: 492px;
            margin-left: -492px
        }
        .nav.fullscreen {
            margin-left: 0;
        }
        .nav .hide-list.fullscreen {
            left: 492px
        }
    }
    
    @media screen and (max-width: 426px) {
        .nav {
            width: 100%;
        }
        .nav-left {
            width: 100%;
        }
    }
    
    
    .nav-right .title-list nav a .post-title, .nav-right .title-list #local-search-result a .post-title {
        color: #383636;
    }
    
    
    .nav-right .title-list nav a .post-date, .nav-right .title-list #local-search-result a .post-date {
        color: #5e5e5f;
    }
    
    
    .nav-right nav a.hover, #local-search-result a.hover{
        background-color: #e2e0e0;
    }
    
    

    /*列表样式*/
    
    .post .pjax article .article-entry>ol, .post .pjax article .article-entry>ul, .post .pjax article>ol, .post .pjax article>ul{
        border: #e2dede solid 1px;
        border-radius: 10px;
        padding: 10px 32px 10px 56px;
    }
    .post .pjax article .article-entry li>ol, .post .pjax article .article-entry li>ul,.post .pjax article li>ol, .post .pjax article li>ul{
        padding-top: 5px;
        padding-bottom: 5px;
    }
    .post .pjax article .article-entry>ol>li, .post .pjax article .article-entry>ul>li,.post .pjax article>ol>li, .post .pjax article>ul>li{
        margin-bottom: auto;
        margin-left: auto;
    }
    .post .pjax article .article-entry li>ol>li, .post .pjax article .article-entry li>ul>li,.post .pjax article li>ol>li, .post .pjax article li>ul>li{
        margin-bottom: auto;
        margin-left: auto;
    }
    

    /* 背景图样式 */
    
    


    /*引用块样式*/
    

    /*文章列表背景图*/
    
    .nav-right:before {
        content: ' ';
        display: block;
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        height: 100%;
        opacity: 0.3;
        background: url("https://i.loli.net/2019/07/22/5d3521411f3f169375.png");
        background-repeat: no-repeat;
        background-position: 50% 0;
        -ms-background-size: cover;
        -o-background-size: cover;
        -moz-background-size: cover;
        -webkit-background-size: cover;
        background-size: cover;
    }
    

    
</style>







</html>
